package org.dendy.app.browser;

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;

/**
 * Class ini berfungsi untuk membuat control di toolbar dan browser
 * 
 * @author dendy
 * 
 */
public class MiniBrowser {

	protected Shell shell;

	protected Browser browser;

	protected FormData data;

	protected Composite control;

	public MiniBrowser(Shell shell) {
		this.shell = shell;
	}

	Composite createComposite(Shell shell) {
		control = new Composite(shell, SWT.NONE);
		data = new FormData();
		data.top = new FormAttachment(0, 0);
		data.left = new FormAttachment(0, 0);
		data.right = new FormAttachment(100, 0);
		control.setLayoutData(data);
		return control;
	}

	Browser createBrowser(Shell shell) {
		browser = new Browser(shell, SWT.NONE);
		data = new FormData();
		data.top = new FormAttachment(control);
		data.bottom = new FormAttachment(100, 0);
		data.left = new FormAttachment(0, 0);
		data.right = new FormAttachment(100, 0);
		browser.setLayoutData(data);
		return browser;
	}

}
